<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="utf-8" />
		<title>新增</title>
		<meta name="viewport" content="width=device-width, initial-scale=1.0" />
		<include file="common/tag"/>
	</head>
	<link rel="stylesheet" href="/static/plugin/ace/css/chosen.css" />
	<script src="/static/plugin/ace/js/chosen.jquery.min.js"></script>
	<style>
		body{
			background-color:#fff
		}
		.yui_right{
			float: right;
			margin-bottom: 10px;
		}
		#container {
			width: 95%;
			height: 300px;
		}
	</style>
	<body >
	<div>
		<div class="widget-main">

			<button class="btn btn-primary yui_right" id="yui_save">
				<i class="icon-plus align-top bigger-125"></i>
				保存
			</button>

			<br>

			<div>
				<label >状态</label>
				<select class="form-control" name="status">
					<option value="0">关闭</option>
					<option value="1" selected>开启</option>
				</select>
			</div>

			<br>

			<div>
				<label >正文</label>
				<textarea id="container" class="content"></textarea>
			</div>

		</div>
	</div>

	</body>
	<include file="common/ueditor"/>
	<script>
		$(function () {
            $(".chosen-select").chosen();

            ue.ready(function() {
                $("#edui1").css('width','100%');
                $("#edui1_iframeholder").css('width','100%');
            });

            $("#yui_save").on('click' , function(){
                var status=$("select[name='status']").val();
                var content=ue.getContent();
                if (ue.hasContents()){
                    //ajax提交数据
                    $.post("/index.php/admin/motto/motto_add",
                        {
                            content:content,
                            status:status
                        },
                        function(data,status){
                            if (data['code']==1){
                                layer.open({
                                    title: '提示',
                                    content: '操作成功'
                                    ,yes: function(index, layero){
                                        window.parent.location.reload();
                                    },cancel: function(){
                                        window.parent.location.reload();
                                    }
                                });
                            }else{
                                layer.msg(data['text']);
                            }
                        }, "json"
                    );
				}else{
                    layer.msg("正文内容不能为空!",{time:1000})
				}


            });

        });
	</script>

</html>
